<?php
class BaseModel {
	/**
	 *
	 * @var IConnector
	 */
	protected $_conn = null;
	protected $_errorCode = null;
	private $_logger;
	public function __construct() {
		Logger::configure ( ROOT_PATH . 'config/log_config.xml' );
		$this->_logger = Logger::getLogger ( __CLASS__ );
		$this->_conn = DBHelper::getDB ( true, false );
		if ($this->_conn == null) {
			$this->_logger->error ( 'Create db connection failed in class ' . __CLASS__ . ' at line ' . __LINE__ );
		}
	}
	protected function setLastError($errorCode) {
		$this->_errorCode = $errorCode;
	}
	public function getLastError() {
		return $this->_errorCode;
	}
}
